<template>
    <div>
        <van-nav-bar title="搜索页面" left-text="返回" left-arrow @click-left="() => { $router.push('/') }" />
        <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />
        <van-card v-for="item in search" :price="item.goods_price" :title="item.goods_name" :thumb=" item.goods_big_logo ? item.goods_big_logo :'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
    </div>
</template>

<script setup>
import { searchApi } from '@/api/api';
import { ref, watch } from 'vue';
let value = ref('')
let search=ref([])
watch(value, (val) => {
    searchApi(val).then(res => {
        console.log('搜索数据', res);
        search.value=res.data.message.goods
    })
})
</script>

<style lang="scss" scoped></style>